import  React from "react";

import { useRoutes, Navigate } from 'react-router-dom'
import Layout from '../components/layout/index'
import Room from './../views/Room/Room'
import Build from './../views/Build/Build'
import Home from './../views/Home/Home'
import Floor from '../views/Floor/Floor'
import RoomSafe from "../views/RoomSafe/RoomSafe";
import BookOrder from "../views/Order/BookOrder/BookOrder";
import EditOrder from "../views/Order/EditOrder/EditOrder";
import NormalOrder from "../views/Order/NormalOrder/NormalOrder";
import QueryOrder from "../views/Order/QueryOrder/QueryOrder";

// 功能页面
const frameIn = [
    { path: 'index', element: <Home /> } ,
    { path: 'room', element: <Room /> },
    { path: 'floor', element: <Floor /> },
    { path: 'build', element: <Build /> },
    { path: 'roomsafe', element: <RoomSafe /> },
    { path: 'bookorder', element: <BookOrder /> },
    { path: 'editorder', element: <EditOrder /> },
    { path: 'normalorder', element: <NormalOrder /> },
    { path: 'queryorder', element: <QueryOrder /> },
    { path: '*', element: <Navigate to="/index" /> }
]


const Router = () => {
    return useRoutes(
        [
            { path: '/', element: <Navigate to="/index" /> },
            { path: "/*", element: <Layout /> , children: frameIn},  
        ]
    )
}


export default  Router